﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PTools.SharePointEntity.Attributes;
using Microsoft.SharePoint;

namespace PTools.SharePointEntity.CommonEntities
{
    /// <summary>
    /// This entity represents a Announcement item from a SharePoint list
    /// </summary>
    [ListAttribute("Announcements")]
    public class Announcement: EntityBase
    {
        #region Properties
        /// <summary>
        /// The Title of the announcement
        /// </summary>
        [FieldAttribute("Title")]
        public string Title { get; set; }

        /// <summary>
        /// Date when it expires
        /// </summary>
        [FieldAttribute("Expires")]
        public DateTime Expires { get; set; }

        /// <summary>
        /// The Text of the announcement
        /// </summary>
        [FieldAttribute("Body")]
        public string Body { get; set; }
        #endregion

        private SPWeb _web;
        #region Constructor
        /// <summary>
        /// Represents a Announcement Item
        /// </summary>
        /// <param name="web">The SPWeb object where the item is located</param>
        public Announcement(SPWeb web)
        {
            _web = web;
        }
        #endregion

        #region Must Implement
        /// <summary>
        /// Returns the SPWeb object
        /// </summary>
        /// <returns></returns>
        public override Microsoft.SharePoint.SPWeb GetWeb()
        {
            return _web;
        }
        #endregion
    }
}
